<?php 
	class Characters extends Eloquent {
		protected $table = 'characters';
    	public $timestamps = false;
    	protected $primaryKey = "char_id";

    	public function user() {
    		return $this->belongsTo('User');
    	}

    	public function scopeSearch($query, $search) {
			$query->where("characters.char_name", "like", '%'.$search.'%')
				->orWhere("characters.char_class", "like", '%'.$search.'%');
		}

		public function scopeMyChar($query, $id)
		{
			$query->where("characters.user_id", "=", $id);
		}
    }